// 获取评论数据
$.ajax({
    type: 'post',
    url: '/admin/commentsData',
    success: function (reslut) {
        var html = template('commentsTpl', {commentsData: reslut});
        $('#tbody').html(html);
    }
})
// 评论删除
function commentsDel(id) {
    if (confirm('您真的要进行删除操作吗')) { 
        $.ajax({
            type: 'post',
            url: '/admin/commentsDel',
            data: {
                id
            },
            success: function (reslut) {
                // console.log(reslut);
                window.location.href = "/admin/comments.html";
            }
        })
    }
}

// 获取分页数据
$.ajax({
    type:'post',
    url: '/admin/commentslimitPage',
    success: (reslut) => {
        var html = template('pageTpl', {commentslimitPage: reslut});
        $('.pagination').html(html)
    }
})

// 评论分页 函数
function changePage(page) {
    $.ajax({
        type: 'post',
        url: '/admin/commentslimit',
        data: {
            page
        },
        success: function (reslut) {
            var html = template('commentsTpl', {commentsData: reslut});
            $('#tbody').html(html);
        }
    })
}